import  Stream  from 'node:stream';
const readStream = async (stream) => {
    if (stream instanceof Stream) {
        return new Promise((resolve, reject) => {
            let data = '';
            stream.on('data', chunk => {
                data += chunk;
            });
            stream.on('end', () => {
                resolve(data);
            });
            stream.on('error', err => {
                reject(err);
            });
        });
    }else{
        return stream
    }
}
export default readStream;